// 2025/8/23
// 小红的子串

#include <iostream>
#include <unordered_map>
using namespace std;

long long AtMostK(string& str, int k)
{
    unordered_map<char, int> count;
    int n = str.size();
    long long ans = 0;
    for(int l = 0, r = 0; r < n; r++)
    {
        count[str[r]]++;
        while(count.size() > k)
        {
            count[str[l]]--;
            if(count[str[l]] == 0)
                count.erase(str[l]);
            l++;
        }
        ans += r - l + 1;
    }
    return ans;
}

int main() {
    int n, l, r; cin >> n >> l >> r;
    string str; cin >> str;

    cout << AtMostK(str, r) - AtMostK(str, l - 1) << endl;
}
// 64 位输出请用 printf("%lld")